# -*- coding: utf-8 -*-
"""
@Author: Logan
@Date:   2025/7/10 16:20
@Description: 
"""
from selenium.webdriver.common.by import By
from base.HomeBase import HomeBase
from base.ObjectMap import ObjectMap
from common.report_add_img import add_img_path_2_report


class HomePage(HomeBase, ObjectMap):

    def get_balance(self, driver):
        """
        获取首页的账户余额
        :param driver:
        :return:
        """
        balance_xpath = self.user_balance()
        # 截图
        element_img_path = self.element_screenshot(driver, By.XPATH, balance_xpath)
        # 添加到allure报告
        add_img_path_2_report(element_img_path, "账户余额截图")
        return self.element_get(driver, By.XPATH, balance_xpath).text
